package com.tjetc.config;

import com.tjetc.interceptor.LoginInterceptor;
import com.tjetc.interceptor.RefreshTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author gaoyongxiang
 * @version v1.0
 * @since 2025-10-20
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        // 拦截器的顺序默认是按照添加顺序执行
//        registry.addInterceptor(
//                new LoginInterceptor(redisTemplate))
//                // 正常写包含登录接口 还有不需要验证登录的业务接口 进行排除
//                .excludePathPatterns("/user/login", "/user/code", "/user/f1")
//                .order(1);
//        registry.addInterceptor(
//                new RefreshTokenInterceptor(redisTemplate)
//        ).order(0);
//    }
}
